package Nio;

import java.net.Socket;
import java.util.Scanner;

/**
 * @author jou
 */
public class IoClient {
    static int port = 1180;
    static String host = "127.0.0.1";

    public static void main(String[] args) {
        try (Socket socket = new Socket(host, port)) {
            while (true) {
                Scanner scanner = new Scanner(System.in);
                String msg = scanner.nextLine();
                if(msg.equals("EOF")){
                    socket.close();
                    break;
                }
                socket.getOutputStream().write(msg.getBytes());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
